package com.fanyouzhao.ehome.service;

import com.fanyouzhao.ehome.entity.Cp;
import com.fanyouzhao.ehome.entity.User;

import java.util.List;


/**
 * User的业务层操作
 *
 * @author fanyouzhao
 * @date 2021年3月31日 下午6:15:36
 */
public interface UserService {

	/**
	 * 注册方法
	 *
	 * @param user
	 * @return
	 * @throws Exception
	 */
	User register(User user) throws Exception;

	/**
	 * 登录方法
	 *
	 * @param phone
	 * @return
	 * @throws Exception
	 */
	User login(String phone) throws Exception;

	/**
	 * 查询全部
	 *
	 * @return
	 * @throws Exception
	 */
	List<User> selectAll() throws Exception;

	/**
	 * 分页查询
	 *
	 * @return
	 * @throws Exception
	 */
	List<User> selectByPage(Integer page,Integer size) throws Exception;
	User selectByPhone(String phone) throws Exception;
	List<Cp> selectCpsNotUsedByPhone(String phone) throws Exception;
	List<Cp> selectCpsUsedByPhone(String phone) throws Exception;
	List<User> searchByPhoneorName(String searchString,Integer page,Integer size) throws Exception;

	//查询某用户未领取的优惠券
	List<Cp> selectNotGetCpsByPhone(String phone) throws Exception;

	//查询某用户已领取的优惠券
	List<Cp> selectGetCpsByPhone(String phone) throws Exception;

	//查询某用户已过期的优惠券
	List<Cp> selectOverExpireCpsByPhone(String phone) throws Exception;

	Boolean getCpn(Integer cpId,String phone)throws Exception;

	Integer getCount() throws Exception;
	Integer getCountSearch(String searchString) throws Exception;

	Boolean isReg(String phone) throws Exception;

	/**
	 * 注销删除
	 *
	 * @param name
	 * @param password
	 * @return
	 * @throws Exception
	 */
	Boolean remove(String name, String password) throws Exception;

	/**
	 * 通过id删除
	 *
	 * @param id
	 * @return
	 * @throws Exception
	 */
	Boolean deleteById(Integer id) throws Exception;

	/**
	 * 修改数据
	 *
	 * @param user
	 * @return
	 * @throws Exception
	 */
	Boolean update(Integer id,User user) throws Exception;

	/**
	 * 修改登录状态
	 *
	 * @param user
	 * @return
	 * @throws Exception
	 */
	Boolean updateIsLogin(User user) throws Exception;

	/**
	 * 修改密码
	 *
	 * @param user
	 * @return
	 * @throws Exception
	 */
	Boolean updatePassword(User user) throws Exception;
}
